package com.member.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.member.shop.domain.SysBizGoods;
import com.member.shop.domain.SysBizGoodsSku;
import com.member.shop.vo.SysBizGoodsSkuExport;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品skuMapper接口
 *
 * @author lixinchen
 * @date 2024-01-05
 */
public interface SysBizGoodsSkuMapper extends BaseMapper<SysBizGoodsSku> {
    /**
     * 查询商品sku
     *
     * @param id 商品sku主键
     * @return 商品sku
     */
    public SysBizGoodsSku selectSysBizGoodsSkuById(Long id);

    /**
     * 查询商品sku列表
     *
     * @param sysBizGoodsSku 商品sku
     * @return 商品sku集合
     */
    public List<SysBizGoodsSku> selectSysBizGoodsSkuList(SysBizGoodsSku sysBizGoodsSku);

    /**
     * 新增商品sku
     *
     * @param sysBizGoodsSku 商品sku
     * @return 结果
     */
    public int insertSysBizGoodsSku(SysBizGoodsSku sysBizGoodsSku);

    /**
     * 修改商品sku
     *
     * @param sysBizGoodsSku 商品sku
     * @return 结果
     */
    public int updateSysBizGoodsSku(SysBizGoodsSku sysBizGoodsSku);

    /**
     * 删除商品sku
     *
     * @param id 商品sku主键
     * @return 结果
     */
    public int deleteSysBizGoodsSkuById(Long goodsId);

    /**
     * 批量删除商品sku
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSysBizGoodsSkuByIds(Long[] ids);


    /**
     * 查询实际销量/商品库存
     *
     * @param ids 查询实际销量
     * @return 结果
     */
    SysBizGoodsSku selectSalesStockCount(Long goodsId);

    int lockStocks(@Param(value = "id") Long id, @Param(value = "number") Long number);

    void releaseStocks(@Param(value = "goodsId") Long goodsId, @Param(value = "specsKey") String specsKey, @Param(value = "number") Long number);

    List<SysBizGoodsSku> selectSkuList(SysBizGoods sysBizGoods);

    List<SysBizGoodsSkuExport> exportList(@Param(value = "ids") List<Long> goodsId);
}
